package com.vx.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.vx.ratingTool.Player;
import com.vx.ratingTool.bo.PlayerBOimpl;
import com.vx.ratingTool.dao.PlayerDAOimpl;

@Controller
@RequestMapping("/showPlayers")
public class ShowPlayersController {

	private PlayerDAOimpl playerDAO;
	private PlayerBOimpl playerBO;

	public PlayerDAOimpl getPlayerDAOimpl() {
		return playerDAO;
	}

	@Autowired
	public void setPlayerDAOimpl(PlayerDAOimpl playerDAO) {
		this.playerDAO = playerDAO;
	}

	public PlayerBOimpl getPlayerBO() {
		return playerBO;
	}

	@Autowired
	public void setPlayerBO(PlayerBOimpl playerBO) {
		this.playerBO = playerBO;
	}

	private List<Player> players;

	@RequestMapping(method = RequestMethod.GET)
	public String CreatePlayers(Model model) {

		model.addAttribute("players", playerBO.GetListOfPlayers());

		return "showPlayers";
	}

}
